package org.xiyinjihe.platform.exception;


import org.xiyinjihe.platform.error.IError;

public class CommonException extends RuntimeException implements IException {

	private IError error;
	private String msg;

	public CommonException(IError error) {
		this(error, null, "");
	}

	public CommonException(IError error, String msg) {
		this(error, null, msg);
	}

	public CommonException(IError error, Throwable cause) {
		this(error, cause, "");
	}

	public CommonException(IError error, Throwable cause, String msg) {
		super(error.getErrorMsg());
		this.error = error;
		this.msg = msg;
	}

	@Override
	public IError getError() {
		return error;
	}

	@Override
	public String getErrorCode() {
		return error.getErrorCode();
	}

	@Override
	public String getErrorTitle() {
		return error.getErrorTitle();
	}

	@Override
	public String getErrorMsg() {
		return error.getErrorMsg() + ":" + this.msg;
	}

}